#ifndef KWDB_SDK_CLIENT_H
#define KWDB_SDK_CLIENT_H

#include "config.h"
#include "point.h"
#include "status.h"
#include <vector>
#include <memory>

namespace kwdb {

// Forward declaration for PIMPL
class KwdbClientImpl;

/**
 * @brief KWDB Ingest Client
 *
 * Client for writing time-series data to KWDB.
 * Uses PIMPL pattern to hide gRPC implementation details.
 */
class KwdbClient {
public:
    /**
     * @brief Construct client with configuration
     * @param config Client configuration (endpoint, timeout, etc.)
     */
    explicit KwdbClient(const IngestConfig& config);

    /**
     * @brief Destructor
     */
    ~KwdbClient();

    // Disable copy
    KwdbClient(const KwdbClient&) = delete;
    KwdbClient& operator=(const KwdbClient&) = delete;

    // Enable move
    KwdbClient(KwdbClient&&) noexcept;
    KwdbClient& operator=(KwdbClient&&) noexcept;

    /**
     * @brief Write a single point
     * @param point Data point to write
     * @return Status of the operation
     */
    Status write(const Point& point);

    /**
     * @brief Write multiple points in a batch
     * @param points Vector of data points
     * @return Status of the operation
     */
    Status batch_write(const std::vector<Point>& points);

    /**
     * @brief Execute a SQL query
     * @param sql SQL query string
     * @param rows Output vector of rows, each row is a vector of string values
     * @return Status of the operation
     */
    Status query(const std::string& sql, std::vector<std::vector<std::string>>& rows);

private:
    std::unique_ptr<KwdbClientImpl> impl_;
};

} // namespace kwdb

#endif // KWDB_SDK_CLIENT_H